package com.example.psychologicalappointmentsystem.Object;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class PageRequest {
    @ApiModelProperty(value = "当前页码，从0开始", dataType = "long")
    private int current ;
    @ApiModelProperty(value = "每页数据量（条）", dataType = "long")
    private int pageSize;

    public void initDefaultPageSize() {
        if (Objects.isNull(current) || current <= 0) {
            setCurrent(0);
        }
        if (Objects.isNull(pageSize) || pageSize <= 0) {
            setPageSize(15);
        }
    }
}
